<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>分配规则</title>
    <hdjs />
    <js file= '__PUBLIC__/js/mod.base.js,__PUBLIC__/js/mod.group.js' />
    <css file= '__PUBLIC__/css/mod.base.css' />
    <style>
	fieldset{
		border: 1px dotted #ccc;
		padding:10px 10px;
		margin: 20px 0;
	}
	h2{
		padding: 0 10px;
	}
	fieldset label{
		margin-right:10px;
	}
    </style>
    <script type="text/javascript">
  
$(function(){


  $('[type=checkbox]').click(function() {
 
      var value = $(this).val();
      if(value == 0)
        return ;

      if($(this).attr('checked')=='checked')
      { 
        $('[pid='+value+']').attr('checked',true);
        $('.'+value).attr('checked',true);
      }
      else
      {
         $('[pid='+value+']').attr('checked',false);
         $('.'+value).attr('checked',false);
      }


     
      // 子级别选中一个父级就要被选中
      var cid =  $(this).attr('class'); 
      $('.'+cid+':checked').length?$('#node'+cid).attr('checked',true):$('#node'+cid).attr('checked',false);

      var id  =  $(this).attr('pid');
      $('[pid='+id+']:checked').length?$('#node'+id).attr('checked',true):$('#node'+id).attr('checked',false);

  });


})

</script>
</head>
<body>
    <form action="" method="post" class="hd-form" name="form" >
        <div class="hd-menu-list">
            <ul>
                <li >
                    <a href="{:U('AuthGroup/index')}">用户组列表</a>
                </li>
                <li class="active">
                    <a href="javascript:;">设置规则</a>
                </li>
            </ul>
        </div>
        
        <div class="hd-title-header">设置规则</div>
        <div class="right_content">
            <table class="hd-table hd-table-form">
                <tbody>
                	<volist name='rule' id='node1'>
	                    <tr>
	                        <td>
	                            <h2>
	                            	<label>
	                            		<input pid='0'  type="checkbox" value="{$node1.id}" id='node{$node1.id}' name="rules[]" <in name='node1.id' value='$field["rules"]'>checked = 'checked' </in> /> {$node1.title}
	                            	</label>
	                            </h2>
	                            <volist name='node1._data' id='node2'>
	                        	<fieldset>
		                           
		                           <legend>
		                            	<label><input pid='{$node1.id}' type="checkbox" value="{$node2.id}"  id='node{$node2.id}' name="rules[]" <in name='node2.id' value='$field["rules"]'>checked = 'checked' </in>/> {$node2.title}</label>
		                            </legend>
		                         	
		                            	<volist name='node2._data' id='node3'>
				                            <label>
				                            	<input pid='{$node1.id}' type="checkbox" value="{$node3.id}" class='{$node2.id}' name="rules[]" <in name='node3.id' value='$field["rules"]'>checked = 'checked' </in>/> {$node3.title}
				                            </label>
		                				</volist>
		                			
	                            </fieldset>
	                           
	              
	                  
	                	</volist>
	                        </td>
	                    </tr>


                	</volist>
                </tbody>
            </table>
        </div>
        <input type="hidden" name="id" value="{$Think.get.id}" />
        <input type="submit" value="分配规则" class="hd-btn hd-btn-sm">
        <input type="button" value="返回" class="hd-btn hd-btn-sm" onclick="location.href='{:U('Authgroup/index')}'">
        </form>
</body>
</html>